/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.giant.entities;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinColumns;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author Harold
 */
@Entity
@Table(name = "in_det_order")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "InDetOrder.findAll", query = "SELECT i FROM InDetOrder i"),
    @NamedQuery(name = "InDetOrder.findByIdDetOrder", query = "SELECT i FROM InDetOrder i WHERE i.idDetOrder = :idDetOrder"),
    @NamedQuery(name = "InDetOrder.findByIdOrder", query = "SELECT i FROM InDetOrder i WHERE i.idOrder = :idOrder"),
    @NamedQuery(name = "InDetOrder.findByIdPos", query = "SELECT i FROM InDetOrder i WHERE i.idPos = :idPos"),
    @NamedQuery(name = "InDetOrder.findByIdBrand", query = "SELECT i FROM InDetOrder i WHERE i.idBrand = :idBrand"),
    @NamedQuery(name = "InDetOrder.findByIdLine", query = "SELECT i FROM InDetOrder i WHERE i.idLine = :idLine"),
    @NamedQuery(name = "InDetOrder.findByIdClass", query = "SELECT i FROM InDetOrder i WHERE i.idClass = :idClass"),
    @NamedQuery(name = "InDetOrder.findByIdCatalog", query = "SELECT i FROM InDetOrder i WHERE i.idCatalog = :idCatalog"),
    @NamedQuery(name = "InDetOrder.findByIdColor", query = "SELECT i FROM InDetOrder i WHERE i.idColor = :idColor"),
    @NamedQuery(name = "InDetOrder.findByIdSize", query = "SELECT i FROM InDetOrder i WHERE i.idSize = :idSize"),
    @NamedQuery(name = "InDetOrder.findBySku", query = "SELECT i FROM InDetOrder i WHERE i.sku = :sku"),
    @NamedQuery(name = "InDetOrder.findByPriceUnit", query = "SELECT i FROM InDetOrder i WHERE i.priceUnit = :priceUnit"),
    @NamedQuery(name = "InDetOrder.findByQuantity", query = "SELECT i FROM InDetOrder i WHERE i.quantity = :quantity"),
    @NamedQuery(name = "InDetOrder.findByStatus", query = "SELECT i FROM InDetOrder i WHERE i.status = :status"),
    @NamedQuery(name = "InDetOrder.findByAnnuled", query = "SELECT i FROM InDetOrder i WHERE i.annuled = :annuled")})
public class InDetOrder implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id_det_order")
    private Integer idDetOrder;
    @Basic(optional = false)
    @NotNull
    @Column(name = "id_order")
    private int idOrder;
    @Basic(optional = false)
    @NotNull
    @Column(name = "id_pos")
    private int idPos;
    @OneToOne
       @JoinColumns({
        @JoinColumn(name="id_brand", referencedColumnName="id_brand", updatable = false, insertable = false)
    })
    private InBrand idBrand;
       @OneToOne
       @JoinColumns({
        @JoinColumn(name="id_line", referencedColumnName="id_line", updatable = false, insertable = false),
        @JoinColumn(name="id_brand", referencedColumnName="id_brand", updatable = false, insertable = false)
    })
    private InLine idLine;
   @OneToOne
      @JoinColumns({
        @JoinColumn(name="id_brand", referencedColumnName="id_brand", updatable = false, insertable = false),
        @JoinColumn(name="id_line", referencedColumnName="id_line",  updatable = false, insertable = false),
        @JoinColumn(name="id_class", referencedColumnName="id_class",  updatable = false, insertable = false)
    })
    private InClass idClass;
     @OneToOne
      @JoinColumns({
        @JoinColumn(name="id_brand", referencedColumnName="id_brand"),
        @JoinColumn(name="id_line", referencedColumnName="id_line"),
        @JoinColumn(name="id_class", referencedColumnName="id_class"),
        @JoinColumn(name="id_catalog", referencedColumnName="id_catalog")
    })
    private InCatalog idCatalog;
    @OneToOne
    @JoinColumn(name = "id_color")
    private InColor idColor;
    @OneToOne
    @JoinColumn(name = "id_size")
    private InSize idSize;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 11)
    @Column(name = "sku")
    private String sku;
    @Basic(optional = false)
    @NotNull
    @Column(name = "price_unit")
    private float priceUnit;
    @Basic(optional = false)
    @NotNull
    @Column(name = "quantity")
    private int quantity;
    @Basic(optional = false)
    @NotNull
    @Column(name = "status")
    private boolean status;
    @Basic(optional = false)
    @NotNull
    @Column(name = "annuled")
    private boolean annuled;

    public InDetOrder() {
    }

    public InDetOrder(Integer idDetOrder) {
        this.idDetOrder = idDetOrder;
    }

    public InDetOrder(Integer idDetOrder, int idOrder, int idPos, InBrand idBrand, InLine idLine, InClass idClass, InCatalog idCatalog, InColor idColor, InSize idSize, String sku, float priceUnit, int quantity, boolean status, boolean annuled) {
        this.idDetOrder = idDetOrder;
        this.idOrder = idOrder;
        this.idPos = idPos;
        this.idBrand = idBrand;
        this.idLine = idLine;
        this.idClass = idClass;
        this.idCatalog = idCatalog;
        this.idColor = idColor;
        this.idSize = idSize;
        this.sku = sku;
        this.priceUnit = priceUnit;
        this.quantity = quantity;
        this.status = status;
        this.annuled = annuled;
    }

    public Integer getIdDetOrder() {
        return idDetOrder;
    }

    public void setIdDetOrder(Integer idDetOrder) {
        this.idDetOrder = idDetOrder;
    }

    public int getIdOrder() {
        return idOrder;
    }

    public void setIdOrder(int idOrder) {
        this.idOrder = idOrder;
    }

    public int getIdPos() {
        return idPos;
    }

    public void setIdPos(int idPos) {
        this.idPos = idPos;
    }

    public InBrand getIdBrand() {
        return idBrand;
    }

    public void setIdBrand(InBrand idBrand) {
        this.idBrand = idBrand;
    }

    public InLine getIdLine() {
        return idLine;
    }

    public void setIdLine(InLine idLine) {
        this.idLine = idLine;
    }

    public InClass getIdClass() {
        return idClass;
    }

    public void setIdClass(InClass idClass) {
        this.idClass = idClass;
    }

    public InCatalog getIdCatalog() {
        return idCatalog;
    }

    public void setIdCatalog(InCatalog idCatalog) {
        this.idCatalog = idCatalog;
    }

    public InColor getIdColor() {
        return idColor;
    }

    public void setIdColor(InColor idColor) {
        this.idColor = idColor;
    }

    public InSize getIdSize() {
        return idSize;
    }

    public void setIdSize(InSize idSize) {
        this.idSize = idSize;
    }

    public String getSku() {
        return sku;
    }

    public void setSku(String sku) {
        this.sku = sku;
    }

    public float getPriceUnit() {
        return priceUnit;
    }

    public void setPriceUnit(float priceUnit) {
        this.priceUnit = priceUnit;
    }

    public int getQuantity() {
        return quantity;
    }

    public void setQuantity(int quantity) {
        this.quantity = quantity;
    }

    public boolean getStatus() {
        return status;
    }

    public void setStatus(boolean status) {
        this.status = status;
    }

    public boolean getAnnuled() {
        return annuled;
    }

    public void setAnnuled(boolean annuled) {
        this.annuled = annuled;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idDetOrder != null ? idDetOrder.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof InDetOrder)) {
            return false;
        }
        InDetOrder other = (InDetOrder) object;
        if ((this.idDetOrder == null && other.idDetOrder != null) || (this.idDetOrder != null && !this.idDetOrder.equals(other.idDetOrder))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.giant.entities.InDetOrder[ idDetOrder=" + idDetOrder + " ]";
    }
    
}
